define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function ($, undefined, Backend, Table, Form, undefined) {

    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'dahui/dingdan/index',
                    add_url: 'dahui/dingdan/add',
                    edit_url: 'dahui/dingdan/edit',
                    del_url: 'dahui/dingdan/del',
                    audit_url: 'dahui/dingdan/audit',
                    multi_url: 'dahui/dingdan/multi',
                    table: 'dahui_dingdan',
                }
            });

            var table = $("#table");

            //给添加按钮添加`data-area`属性
            $(".btn-add").data("area", ["100%", "100%"]);
            $(".btn-audit").data("area", ["100%", "100%"]);
            //当内容渲染完成给编辑按钮添加`data-area`属性
            table.on('post-body.bs.table', function (e, settings, json, xhr) {
                $(".btn-editone").data("area", ["100%", "100%"]);
                $(".btn-auditone").data("area", ["100%", "100%"]);
            });

            var editagencyfees = false;
            if (Config.caozuo || Config.luru || Config.audit) {
                editagencyfees = true;
            }

            //$(".btn-refresh").trigger("click");

            var strfilter = "";
            var strop = "";

            var filter0 = {};
            filter0['orderdate'] = Controller.api.defaultdate2();
            strfilter = JSON.stringify(filter0);
            var op0 = {};
            op0['orderdate'] = "RANGE";
            strop = JSON.stringify(op0);

            //在普通搜索提交搜索前
            table.on('common-search.bs.table', function (event, table, query) {

                console.log("1111");
                var filter = {};//创建空对象
                //拷贝不为空的字段
                for (var key in query.filter) {
                    if (query.filter[key]) {
                        filter[key] = query.filter[key];
                    }
                }
                console.log(filter);

                strfilter = JSON.stringify(filter);
                strop = JSON.stringify(query.op);
                console.log(query.op);
            });

            table.on('post-body.bs.table', function (e, settings, json, xhr) {
                console.log("5555");
                console.log(e, settings, json, xhr);
            });

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                showToggle: false,
                search: false,
                sortName: 'id',
                searchFormVisible: true,
                dblClickToEdit: false, //是否启用双击编辑
                showExport: false,
                columns: [
                    [
                        {checkbox: true},
                        {field: 'id', title: __('Id'),  sortable: true},
                        {field: 'auditstatus', title: __('Auditstatus'), searchList: {"未审核":__('未审核'), "已审核":__('已审核')}, formatter: Table.api.formatter.normal, sortable: true},
                        {field: 'newkehu', title: __('Newkehu'), searchList: {"":__(''),"是":__('是') }, formatter: Table.api.formatter.normal, sortable: true},
                        {field: 'preprocessing', title: __('Preprocessing'), searchList: {"":__(''),"是":__('是') }, formatter: Table.api.formatter.normal, sortable: true},
                        {field: 'orderdate', title: __('Orderdate'), defaultValue: Controller.api.defaultdate2(), operate:'RANGE', addclass:'datetimerange', sortable: true},
                        {field: 'businesstype', title: __('Businesstype'), operate: false, searchList: {"个税":__('个税'),"公积金":__('公积金'),"社保":__('社保'),"补充公积金":__('补充公积金')}, formatter: Table.api.formatter.normal, sortable: true},
                        {field: 'taobaoname', title: __('Taobaoname'), operate: 'LIKE %...%', placeholder: '模糊搜索，*表示任意字符', formatter:Controller.api.formatter.taobaoname, sortable: true},

                        {field: 'kehu.name', title: __('Kehu.name'), operate: false, formatter: Table.api.formatter.search, sortable: true},
                        {field: 'idnumber', title: __('身份证号*'), operate: 'LIKE %...%', placeholder: '模糊搜索，*表示任意字符', formatter: Controller.api.formatter.idnumber},
                        {field: 'paymentbase', title: __('Paymentbase'), operate: false, sortable: true, formatter: Controller.api.formatter.paymentbase},
                        {field: 'paymentamount', title: __('Paymentamount'), operate: false, sortable: true},
                        {field: 'paymentdate', title: __('Paymentdate'), operate: false, placeholder: '模糊搜索，*表示任意字符', formatter: Controller.api.formatter.paymentdate},
                        {
                            field: 'agencyfees',
                            title: __('付代理费*'),
                            editable: {
                                emptytext: '无',
                                rows:10,
                                tpl: "<textarea rows='10' cols='50'></textarea>",
                                disabled: !editagencyfees, //true 则不能编辑 ---- 操作权限
                                success: function (response, newValue) {
                                    //$(".btn-refresh").trigger("click");
                                }
                            },
                            operate: 'LIKE %...%',
                            placeholder: '模糊搜索，*表示任意字符',
                            align: 'left',
                        },
                        {field: 'payingcompany', title: __('Payingcompany'), operate: false, formatter: Table.api.formatter.search, sortable: true},
                        {
                            field: 'ordercomment',
                            title: __('订单备注*'),
                            editable: {
                                emptytext: '无',
                                rows:10,
                                tpl: "<textarea rows='10' cols='50'></textarea>",
                                disabled: !Config.caozuo , //true 则不能编辑 ---- 操作权限
                                success: function (response, newValue) {
                                    //$(".btn-refresh").trigger("click");
                                }
                            },
                            operate: false
                        },
                        {field: 'kehu.mobile', title: __('Kehu.mobile'), formatter: function (value, row, index) {

                            return [
                                '<a href="javascript:;" class="btn btn-xs">' + value + '</a>'
                            ].join("")

                        }},
                        {field: 'paymentnumber', title: __('Paymentnumber'), operate: 'LIKE %...%', placeholder: '模糊搜索，*表示任意字符', formatter: Table.api.formatter.search, sortable: true},
                        //{
                        //    field: 'paymentnumber',
                        //    title: __('缴纳号码*'),
                        //    editable: {
                        //        emptytext: '无',
                        //        rows:2,
                        //        tpl: "<textarea rows='2' cols='20'></textarea>",
                        //        disabled: !Config.luru , //true 则不能编辑 ---- 操作权限
                        //        success: function (response, newValue) {
                        //            //$(".btn-refresh").trigger("click");
                        //        }
                        //    },
                        //    operate: 'LIKE %...%',
                        //    placeholder: '模糊搜索，*表示任意字符'
                        //},

                        {field: 'luruman', title: __('录入员'), operate: false, sortable: true},
                        {field: 'auditman', title: __('审核员'), operate: false, sortable: true},
                        {field: 'opman', title: __('操作员'), operate: false, sortable: true},

                        {
                            field: 'operate',
                            title: __('Operate'),
                            table: table,
                            events: Controller.api.events.operate,
                            formatter: function (value, row, index) {
                                var table = this.table;
                                // 操作配置
                                var options = table ? table.bootstrapTable('getOptions') : {};
                                // 默认按钮组
                                var buttons = $.extend([], this.buttons || []);
                                // 所有按钮名称
                                var names = [];
                                buttons.forEach(function (item) {
                                    names.push(item.name);
                                });
                                if (options.extend.dragsort_url !== '' && names.indexOf('dragsort') === -1) {
                                    buttons.push({
                                        name: 'dragsort',
                                        icon: 'fa fa-arrows',
                                        title: __('Drag to sort'),
                                        extend: 'data-toggle="tooltip"',
                                        classname: 'btn btn-xs btn-primary btn-dragsort'
                                    });
                                }
                                if (options.extend.edit_url !== '' && names.indexOf('edit') === -1 && row.auditstatus == "未审核" && (Config.luru || Config.audit)) {
                                    buttons.push({
                                        name: 'edit',
                                        icon: 'fa fa-pencil',
                                        title: __('修改'),
                                        extend: 'data-toggle="tooltip"',
                                        classname: 'btn btn-xs btn-success btn-editone',
                                        url: options.extend.edit_url
                                    });
                                }

                                if (options.extend.audit_url !== '' && names.indexOf('audit') === -1 && row.auditstatus == "未审核" && Config.audit) {
                                    buttons.push({
                                        name: 'audit',
                                        icon: 'fa fa-gavel',
                                        title: __('审核'),
                                        extend: 'data-toggle="tooltip"',
                                        classname: 'btn btn-xs btn-success btn-auditone',
                                        url: options.extend.audit_url
                                    });
                                }

                                if (options.extend.del_url !== '' && names.indexOf('del') === -1 && row.auditstatus == "未审核") {
                                    buttons.push({
                                        name: 'del',
                                        icon: 'fa fa-trash',
                                        title: __('Del'),
                                        extend: 'data-toggle="tooltip"',
                                        classname: 'btn btn-xs btn-danger btn-delone'
                                    });
                                }
                                return Table.api.buttonlink(this, buttons, value, row, index, 'operate');
                            }
                        },
                        {
                            field: 'payingcompany',
                            title: __('Businesstype') + "|" + __('公司'),
                            visible: false,
                            searchList: function (column) {
                                //console.log('1111');
                                //console.log(column);
                                return Template('categorytpl', {});
                            }
                        },
                     ]
                ]
            });


            //导出
            $(document).on("click", ".btn-myexcel-export", function () {
                top.location.href = "import0?filter=" + strfilter + "&op=" + strop;

            });

            function postL(URL, PARAMS) {
                var temp = document.createElement("form");
                temp.action = URL;
                temp.method = "post";
                temp.style.display = "none";
                for (var x in PARAMS) {
                    var opt = document.createElement("textarea");
                    opt.name = x;
                    opt.value = PARAMS[x];
                    // alert(opt.name)
                    temp.appendChild(opt);
                }
                document.body.appendChild(temp);
                temp.submit();
                return temp;
            }

            $('a[data-toggle="tab"]').on("shown.bs.tab", function (e) {
                var value = $(e.target).data('value');
                console.log(value);
                //$("select[name='businesstype'] option[value='" + "个税" + "']", table.closest(".bootstrap-table").find(".commonsearch-table")).prop("selected", true);

                var options = table.bootstrapTable('getOptions');
                options.pageNumber = 1;
                options.queryParams = function(params) {
                    params.filter = JSON.stringify({businesstype: "个税"});
                    params.op = JSON.stringify({businesstype: "="});
                    //params.type = value;
                    //params.businesstype = "个税";
                    return params;
                };

               table.bootstrapTable('refresh', {});

            });

            // 批量审核
            $(document).on("click", ".btn-selected", function () {
                if (Config.audit) {
                    var ids = Table.api.selectedids(table);
                    var url = 'dahui/dingdan/allaudit?ids=' + ids;

                    var that = this;
                    Layer.confirm(__('确定批量审核?'), {icon: 3, title: '提示'}, function (index) {
                        Backend.api.ajax({
                            url: url,
                        }, function () {
                            Layer.close(index);
                            $(".btn-refresh").trigger("click");
                        });
                    });
                }
            });

            //点击复制
            $(document).on("click", ".taobaoname[data-tbname]", function () {
                var name = $(this).data('tbname');
                Backend.api.toastr.success("[已复制]  " + name);
                //window.clipboardData.setData("Text", name);
                var oInput = document.createElement('input');
                oInput.value = name;
                document.body.appendChild(oInput);
                oInput.select();
                document.execCommand("Copy");
                oInput.style.display = 'none';
                document.body.removeChild(oInput);
                return false;
            });

            $(document).on("dblclick", ".idnumber", function () {
                var url = $(this).data('id');
                window.parent.location.href = url;
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        index1: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'dahui/dingdan/index1',
                    add_url: '',
                    edit_url: 'dahui/dingdan/edit1',
                    del_url: 'dahui/dingdan/del1',
                    multi_url: '',
                    table: 'dahui_dingdan1',
                }
            });

            var table = $("#table");
            var idnumber = '';

            var editagencyfees = false;
            if (Config.caozuo || Config.luru || Config.audit) {
                editagencyfees = true;
            }

            table.on('post-body.bs.table', function (e, settings, json, xhr) {
                $(".btn-editone").data("area", ["50%", "50%"]);
            });

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                showToggle: false,
                sortName: 'id',
                searchFormVisible: true,
                showColumns: false,
                search: false,
                dblClickToEdit: false, //是否启用双击编辑
                showExport: false,
                pageSize: 'All',
                pageList: ['All'],
                columns: [
                    [
                        //{checkbox: true},
                        //{field: 'id', title: __('Id'), visible:false, operate:false},
                        {field: 'businesstype', title: __('Businesstype'), searchList: {"个税":__('个税'),"公积金":__('公积金'),"社保":__('社保'),"补充公积金":__('补充公积金')}, formatter: Table.api.formatter.normal},
                        {field: 'paymentdate', title: __('Paymentdate'),  operate:false, formatter: Table.api.formatter.search},
                        {field: 'taobaoname', title: __('Taobaoname'),  operate:false, formatter: Table.api.formatter.search},
                        {field: 'kehu.name', title: __('Kehu.name'), operate: false, editable:false},
                        {
                            field: 'kehu.mobile',
                            title: __('Kehu.mobile'),
                            editable: {
                                emptytext: '无',
                                disabled: !editagencyfees , //true 则不能编辑 ---- 审核和操作权限
                                success: function (response, newValue) {

                                    setTimeout(function () {
                                        table.bootstrapTable('refresh', {});
                                    }, 2000);
                                }
                            },
                            operate: false
                        },
                        //{field: 'paymentnumber', title: __('Paymentnumber'), operate: 'LIKE %...%', placeholder: '模糊搜索，*表示任意字符'},
                        {
                            field: 'paymentnumber',
                            title: __('缴纳号码*'),
                            editable: {
                                emptytext: '无',
                                disabled: !editagencyfees , //true 则不能编辑 ---- 操作权限
                                success: function (response, newValue) {
                                    console.log("success", newValue);
                                    //如直接刷这样会先刷列表再编辑
                                    //$(".btn-refresh").trigger("click");
                                    setTimeout(function () {
                                        table.bootstrapTable('refresh', {});
                                    }, 2000);
                                }
                            },
                            operate: false
                        },
                        {field: 'payingcompany', title: __('Payingcompany'), operate: false, formatter: Table.api.formatter.search},
                        {field: 'paymentbase', title: __('Paymentbase'), operate: false, formatter: Controller.api.formatter.paymentbase},
                        {field: 'paymentamount', title: __('Paymentamount'), operate:false},
                        {field: 'refundornot', title: __('是否退款*'), operate:false, formatter: Controller.api.formatter.tkstatus},
                        //{
                        //    field: 'refundornot',
                        //    title: __('是否退款*'),
                        //    operate:false,
                        //    editable: {
                        //        type: 'select',
                        //        pk: 1,
                        //        emptytext: '--',
                        //        source: [
                        //            {value: '待退款', text: ' 待退款 '},
                        //            {value: '已退款', text: ' 已退款 '},
                        //            {value: '', text: ' --﻿'},
                        //        ],
                        //        //noeditFormatter: function (value, row, index) {
                        //        //    //return '<a href="javascript:;" class="text-danger"> 已退款 </a>';
                        //        //    return value;
                        //        //}
                        //    },
                        //},
                        {field: 'idnumber', title: __('idnumber'), visible:false},
                        {field: 'luruman', title: __('录入员'), operate: false, sortable: true},
                        {field: 'auditman', title: __('审核员'), operate: false, sortable: true},
                        {field: 'opman', title: __('操作员'), operate: false, sortable: true},
                        {
                            field: 'operate',
                            title: __('Operate'),
                            table: table,
                            events: Table.api.events.operate,
                            formatter: function (value, row, index) {
                                var table = this.table;
                                // 操作配置
                                var options = table ? table.bootstrapTable('getOptions') : {};
                                // 默认按钮组
                                var buttons = $.extend([], this.buttons || []);
                                // 所有按钮名称
                                var names = [];
                                buttons.forEach(function (item) {
                                    names.push(item.name);
                                });
                                if (options.extend.dragsort_url !== '' && names.indexOf('dragsort') === -1) {
                                    buttons.push({
                                        name: 'dragsort',
                                        icon: 'fa fa-arrows',
                                        title: __('Drag to sort'),
                                        extend: 'data-toggle="tooltip"',
                                        classname: 'btn btn-xs btn-primary btn-dragsort'
                                    });
                                }
                                //if (options.extend.edit_url !== '' && names.indexOf('edit') === -1 && row.auditstatus == "未审核" && Config.audit == true) {
                                //    buttons.push({
                                //        name: 'edit',
                                //        icon: 'fa fa-gavel',
                                //        title: __('审核'),
                                //        extend: 'data-toggle="tooltip"',
                                //        classname: 'btn btn-xs btn-success btn-editone',
                                //        url: options.extend.edit_url
                                //    });
                                //}
                                if (options.extend.del_url !== '' && names.indexOf('del') === -1 && Config.audit && Config.luru && Config.caozuo) {
                                    buttons.push({
                                        name: 'del',
                                        icon: 'fa fa-trash',
                                        title: __('Del'),
                                        extend: 'data-toggle="tooltip"',
                                        classname: 'btn btn-xs btn-danger btn-delone'
                                    });
                                }
                                return Table.api.buttonlink(this, buttons, value, row, index, 'operate');
                            }
                        },
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);

            var strfilter = "";
            var strop = "";

            //当表格数据加载完成时
            table.on('load-success.bs.table', function (e, data) {
                idnumber = data.idnumber;
                var note = data.note;
                if (note == null || note.length < 1) {
                    note = "*客户备注";
                }
                $("#c_note").text(note);

                if (strfilter.length < 1) {
                    var filter0 = {};
                    filter0['idnumber'] = idnumber;
                    strfilter = JSON.stringify(filter0);
                    var op0 = {};
                    op0['idnumber'] = "=";
                    strop = JSON.stringify(op0);
                }

            });

            //在普通搜索提交搜索前
            table.on('common-search.bs.table', function (event, table, query) {
                var filter = {};//创建空对象
                //拷贝不为空的字段
                for (var key in query.filter) {
                    if (query.filter[key]) {
                        filter[key] = query.filter[key];
                    }
                }
                console.log(filter);

                strfilter = JSON.stringify(filter);
                strop = JSON.stringify(query.op);
                console.log(query.op);
            });

            //导出
            $(document).on("click", ".btn-myexcel-export", function () {
                top.location.href = "import1?filter=" + strfilter + "&op=" + strop;
            });

            $(document).on('click', '.beizu', function () {
                //获取选中的条目ID集合
                if (Config.audit) {
                    var url = 'dahui/dingdan/editkehunote?idnumber=' + idnumber;//弹出窗口 add.html页面的（fastadmin封装layer模态框将以iframe的方式将add输出到index页面的模态框里）

                    var options = {
                        shadeClose: false,
                        shade: [0.3, '#393D49'],
                        area: ["60%", "60%"],
                        callback:function(data){
                            //CallBackFun(value.id, value.name);//在回调函数里可以调用你的业务代码实现前端的各种逻辑和效果
                            $("#c_note").text(data);
                            //$(".btn-refresh").trigger("click");
                        }
                    };
                    Fast.api.open(url, "客户备注", options);
                }
            });

            //点击退款状态
            $(document).on("dblclick", ".tkstatus[data-id]", function () {

                if (Config.audit) {
                    var url = 'dahui/dingdan/changetstatus';
                    var id = $(this).data('id');
                    var _this = $(this);
                    Fast.api.ajax({
                        url: url,
                        data: {ids: id},
                    }, function (data, ret) {
                        console.log(ret.data.refundornot);
                        _this.removeClass('text-success')
                        _this.removeClass('text-warning')
                        _this.removeClass('text-danger')
                        if (ret.data.refundornot == '已退款') {
                            _this.addClass('text-success');
                            _this.html(ret.data.refundornot);
                        } else if (ret.data.refundornot == '待退款') {
                            _this.addClass('text-warning');
                            _this.html(ret.data.refundornot);
                        } else if (ret.data.refundornot == '需退款') {
                            _this.addClass('text-danger');
                            _this.html(ret.data.refundornot);
                        } else {
                            _this.html('--');
                        }

                    });
                } else  if (Config.caozuo) {
                    var url = 'dahui/dingdan/changetstatus2';
                    var id = $(this).data('id');
                    var _this = $(this);
                    Fast.api.ajax({
                        url: url,
                        data: {ids: id},
                    }, function (data, ret) {
                        console.log(ret.data.refundornot);
                        _this.removeClass('text-success')
                        _this.removeClass('text-warning')
                        _this.removeClass('text-danger')
                        if (ret.data.refundornot == '已退款') {
                            _this.addClass('text-success');
                            _this.html(ret.data.refundornot);
                        } else if (ret.data.refundornot == '待退款') {
                            _this.addClass('text-warning');
                            _this.html(ret.data.refundornot);
                        } else if (ret.data.refundornot == '需退款') {
                            _this.addClass('text-danger');
                            _this.html(ret.data.refundornot);
                        } else {
                            _this.html('--');
                        }

                    });
                }

            });

        },
        index2: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'dahui/dingdan/index2',
                    add_url: '',
                    edit_url: 'dahui/dingdan/edit2',
                    del_url: '',
                    multi_url: '',
                    table: 'dahui_dingdan3',
                }
            });

            var table = $("#table");

            table.on('post-body.bs.table', function (e, settings, json, xhr) {
                $(".btn-editone").data("area", ["50%", "50%"]);
            });

            //当表格数据加载完成时
            table.on('load-success.bs.table', function (e, data) {
                $("#money").text(data.extend.money);
            });

            var strfilter = "";
            var strop = "";
            if (strfilter.length < 1) {
                var filter0 = {};
                filter0['paymentdate'] = Controller.api.defaultdate();
                strfilter = JSON.stringify(filter0);
                var op0 = {};
                op0['paymentdate'] = "=";
                strop = JSON.stringify(op0);
            }
            //在普通搜索提交搜索前
            table.on('common-search.bs.table', function (event, table, query) {

                var filter = {};//创建空对象
                //拷贝不为空的字段
                for (var key in query.filter) {
                    if (query.filter[key]) {
                        filter[key] = query.filter[key];
                    }
                }
                console.log(filter);

                strfilter = JSON.stringify(filter);
                strop = JSON.stringify(query.op);
                //console.log(query);
            });

            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                showToggle: false,
                sortName: 'id',
                searchFormVisible: true,
                showToggle: false,
                showColumns: false,
                search: false,
                dblClickToEdit: false, //是否启用双击编辑
                showExport: false,
                columns: [
                    [
                        //{checkbox: true},
                        //{field: 'id', title: __('Id'), operate: false, sortable: true},
                        {field: 'businesstype', title: __('Businesstype'), operate: false, searchList: {"个税":__('个税'),"公积金":__('公积金'),"社保":__('社保'),"补充公积金":__('补充公积金')}, formatter: Table.api.formatter.normal, sortable: true},
                        {field: 'paymentdate2', title: __('提醒年月'), operate: false},
                        {field: 'paymentdate', visible: false, title: __('提醒年月'), defaultValue: Controller.api.defaultdate(), addclass:'datetimepicker', formatter: Table.api.formatter.search},
                        {field: 'taobaoname', title: __('Taobaoname'), operate: 'LIKE %...%', placeholder: '模糊搜索，*表示任意字符', formatter: Table.api.formatter.search, sortable: true},
                        {field: 'idnumber', title: __('身份证号*'), operate: 'LIKE %...%', placeholder: '模糊搜索，*表示任意字符', formatter: Controller.api.formatter.idnumber},
                        {field: 'kehuname', title: __('Kehu.name'), operate: false},
                        {field: 'kehumobile', title: __('Kehu.mobile'), operate: false, formatter: function (value, row, index) {

                            return [
                                '<a href="javascript:;" class="btn btn-xs">' + value + '</a>'
                            ].join("")

                        }},
                        {field: 'paymentnumber', title: __('缴纳号码'), operate: 'LIKE %...%', placeholder: '模糊搜索，*表示任意字符', formatter: Table.api.formatter.search},
                        {field: 'payingcompany', title: __('Payingcompany'), operate: false, formatter: Table.api.formatter.search, sortable: true},
                        {field: 'paymentbase', title: __('Paymentbase'), operate: false, sortable: true, formatter: Controller.api.formatter.paymentbase},
                        {field: 'paymentamount', title: __('Paymentamount'), operate:false, sortable: true},
                        {field: 'agencyfees', title: __('付代理费'), operate:false},
                        //{field: 'ylr', title: __('已录入'), defaultValue: "否", operate:false},
                        //{field: 'yzc', title: __('已转出'), defaultValue: "是", operate:false},
                        //{field: 'auditstatus', title: __('审核状态'), operate:false},
                        //{field: 'zc_status', title: __('转出状态'), searchList: {"办理失败":__('办理失败'),"已办理":__('已办理'),"未办理":__('未办理')}, formatter: Table.api.formatter.search, sortable: true},


                        {
                            field: 'payingcompany',
                            title: __('Businesstype') + "|" + __('公司'),
                            visible: false,
                            searchList: function (column) {
                                console.log('1111');
                                console.log(column);
                                return Template('categorytpl', {});
                            }
                        },
                        //{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                    ]
                ]
            });

            var form = $("form.form-commonsearch");
            if ($(".datetimepicker", form).size() > 0) {
                require(['bootstrap-datetimepicker'], function () {
                    var options = {
                        format: 'YYYY-MM',
                        icons: {
                            time: 'fa fa-clock-o',
                            date: 'fa fa-calendar',
                            up: 'fa fa-chevron-up',
                            down: 'fa fa-chevron-down',
                            previous: 'fa fa-chevron-left',
                            next: 'fa fa-chevron-right',
                            today: 'fa fa-history',
                            clear: 'fa fa-trash',
                            close: 'fa fa-remove'
                        },
                        showTodayButton: true,
                        showClose: true
                    };
                    $('.datetimepicker', form).parent().css('position', 'relative');
                    $('.datetimepicker', form).datetimepicker(options);
                });
            }

            //导出
            $(document).on("click", ".btn-myexcel-export", function () {
                top.location.href = "import2?filter=" + strfilter + "&op=" + strop;
            });

            $(document).on("dblclick", ".idnumber", function () {
                var url = $(this).data('id');
                window.parent.location.href = url;
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        index3: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'dahui/dingdan/index3',
                    add_url: '',
                    edit_url: 'dahui/dingdan/edit3',
                    del_url: '',
                    multi_url: '',
                    table: 'dahui_dingdan3',
                }
            });

            var table = $("#table");

            table.on('post-body.bs.table', function (e, settings, json, xhr) {
                $(".btn-editone").data("area", ["50%", "50%"]);
            });

            //当表格数据加载完成时
            table.on('load-success.bs.table', function (e, data) {
                $("#money").text(data.extend.money);
            });

            var yearpayment = Controller.api.defaultdate();

            var strfilter = "";
            var strop = "";
            //在普通搜索提交搜索前
            table.on('common-search.bs.table', function (event, table, query) {
                yearpayment = query.filter['paymentdate'];
                var filter = {};//创建空对象
                //拷贝不为空的字段
                for (var key in query.filter) {
                    if (query.filter[key]) {
                        filter[key] = query.filter[key];
                    }
                }
                console.log(filter);

                strfilter = JSON.stringify(filter);
                strop = JSON.stringify(query.op);
                //console.log(query);
            });
            if (strfilter.length < 1) {
                var filter0 = {};
                filter0['paymentdate'] = Controller.api.defaultdate();
                strfilter = JSON.stringify(filter0);
                var op0 = {};
                op0['paymentdate'] = "=";
                strop = JSON.stringify(op0);
            }

            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                showToggle: false,
                sortName: 'id',
                searchFormVisible: true,
                showExport: false,
                showColumns: false,
                search: false,
                dblClickToEdit: false, //是否启用双击编辑
                columns: [
                    [
                        //{checkbox: true},
                        //{field: 'id', title: __('Id'), operate: false, sortable: true},
                        {field: 'businesstype', title: __('Businesstype'), operate: false, searchList: {"个税":__('个税'),"公积金":__('公积金'),"社保":__('社保'),"补充公积金":__('补充公积金')}, formatter: Table.api.formatter.normal, sortable: true},
                        {field: 'paymentdate', title: __('续费年月'), defaultValue: Controller.api.defaultdate(), addclass:'datetimepicker', formatter: Table.api.formatter.search},
                        {field: 'taobaoname', title: __('Taobaoname'), operate: 'LIKE %...%', placeholder: '模糊搜索，*表示任意字符', formatter: Table.api.formatter.search, sortable: true},
                        {field: 'idnumber', title: __('身份证号*'), operate: 'LIKE %...%', placeholder: '模糊搜索，*表示任意字符', formatter: Controller.api.formatter.idnumber},
                        {field: 'kehuname', title: __('Kehu.name'), operate: false},
                        {field: 'kehumobile', title: __('Kehu.mobile'), operate: false, formatter: function (value, row, index) {

                            return [
                                '<a href="javascript:;" class="btn btn-xs">' + value + '</a>'
                            ].join("")

                        }},
                        {field: 'paymentnumber', title: __('缴纳号码'), operate: 'LIKE %...%', placeholder: '模糊搜索，*表示任意字符', formatter: Table.api.formatter.search},
                        {field: 'payingcompany', title: __('Payingcompany'), operate: false, formatter: Table.api.formatter.search, sortable: true},
                        {field: 'paymentbase', title: __('Paymentbase'), operate: false, sortable: true, formatter: Controller.api.formatter.paymentbase},
                        {field: 'paymentamount', title: __('Paymentamount'), operate:false, sortable: true},

                        {
                            field: 'agencyfees',
                            title: __('付代理费*'),
                            editable: {
                                rows:10,
                                tpl: "<textarea rows='10' cols='50'></textarea>",
                                emptytext: '无',
                                disabled: !Config.caozuo , //true 则不能编辑 ---- 操作权限
                                success: function (response, newValue) {
                                    //$(".btn-refresh").trigger("click");
                                }
                            },
                            operate: 'LIKE %...%',
                            placeholder: '模糊搜索，*表示任意字符',
                            align: 'left'
                        },

                        {field: 'zc_status', title: __('转出状态'), operate:false},

                        {field: 'refundornot', title: __('是否退款*'), operate:false, formatter: Controller.api.formatter.tkstatus},

                        {field: 'luruman', title: __('录入员'), operate: false, sortable: true},
                        {field: 'auditman', title: __('审核员'), operate: false, sortable: true},
                        {field: 'opman', title: __('操作员'), operate: false, sortable: true},
                        {
                            field: 'payingcompany',
                            title: __('Businesstype') + "|" + __('公司'),
                            visible: false,
                            searchList: function (column) {
                                console.log('1111');
                                console.log(column);
                                return Template('categorytpl', {});
                            }
                        },
                        //{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                    ]
                ]
            });

            //导出
            $(document).on("click", ".btn-myexcel-export", function () {
                top.location.href = "import3?filter=" + strfilter + "&op=" + strop;
            });

            var form = $("form.form-commonsearch");
            if ($(".datetimepicker", form).size() > 0) {
                require(['bootstrap-datetimepicker'], function () {
                    var options = {
                        format: 'YYYY-MM',
                        icons: {
                            time: 'fa fa-clock-o',
                            date: 'fa fa-calendar',
                            up: 'fa fa-chevron-up',
                            down: 'fa fa-chevron-down',
                            previous: 'fa fa-chevron-left',
                            next: 'fa fa-chevron-right',
                            today: 'fa fa-history',
                            clear: 'fa fa-trash',
                            close: 'fa fa-remove'
                        },
                        showTodayButton: true,
                        showClose: true
                    };
                    $('.datetimepicker', form).parent().css('position', 'relative');
                    $('.datetimepicker', form).datetimepicker(options);
                });
            }

            // 批量修改基数
            $(document).on("click", ".plxgjs", function () {
                if (Config.caozuo) {
                    var that = this;
                    Layer.confirm('确定批量修改' + yearpayment + '月及之后续费客户最低缴纳基数？', function () {
                        var url = 'dahui/dingdan/xgjs?yearpayment=' + yearpayment;
                        Fast.api.ajax(url, function () {
                            Layer.closeAll();
                            table.bootstrapTable('refresh');
                        }, function () {
                            Layer.closeAll();
                        });
                    });
                }
                return false;
            });

            //导出
            $(document).on("click", ".btn-myexcel-export", function () {
                top.location.href="import3?filter=" + strfilter;
            });

            $(document).on("dblclick", ".idnumber", function () {
                var url = $(this).data('id');
                window.parent.location.href = url;
            });

            $(document).on("dblclick", ".tkstatus[data-id]", function () {

                if (Config.caozuo) {
                    var url = 'dahui/dingdan/changetstatus2';
                    var id = $(this).data('id');
                    var _this = $(this);
                    Fast.api.ajax({
                        url: url,
                        data: {ids: id},
                    }, function (data, ret) {
                        console.log(ret.data.refundornot);
                        _this.removeClass('text-success')
                        _this.removeClass('text-warning')
                        _this.removeClass('text-danger')
                        if (ret.data.refundornot == '已退款') {
                            _this.addClass('text-success');
                            _this.html(ret.data.refundornot);
                        } else if (ret.data.refundornot == '待退款') {
                            _this.addClass('text-warning');
                            _this.html(ret.data.refundornot);
                        } else if (ret.data.refundornot == '需退款') {
                            _this.addClass('text-danger');
                            _this.html(ret.data.refundornot);
                        } else {
                            _this.html('--');
                        }
                    });
                }

            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        index4: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'dahui/dingdan/index4',
                    add_url: '',
                    edit_url: 'dahui/dingdan/edit4',
                    del_url: '',
                    multi_url: '',
                    table: 'dahui_dingdan4',
                }
            });

            var editagencyfees = false;
            if (Config.caozuo || Config.audit || Config.luru) {
                editagencyfees = true;
            }

            var table = $("#table");
            table.on('post-body.bs.table', function (e, settings, json, xhr) {
                $(".btn-editone").data("area", ["50%", "50%"]);
            });
            //业务+年月
            //当表格数据加载完成时
            table.on('load-success.bs.table', function (e, data) {
                $("#money").text(data.extend.money);
            });

            var strfilter = "";
            var strop = "";
            //在普通搜索提交搜索前
            table.on('common-search.bs.table', function (event, table, query) {

                console.log("A11111");
                var filter = {};//创建空对象
                //拷贝不为空的字段
                for (var key in query.filter) {
                    if (query.filter[key]) {
                        filter[key] = query.filter[key];
                    }
                }
                console.log(filter);

                strfilter = JSON.stringify(filter);
                strop = JSON.stringify(query.op);
                //console.log(query);
            });

            if (strfilter.length < 1) {
                var filter0 = {};
                filter0['paymentdate'] = Controller.api.defaultdate();
                strfilter = JSON.stringify(filter0);
                var op0 = {};
                op0['paymentdate'] = "=";
                strop = JSON.stringify(op0);
            }

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                showToggle: false,
                sortName: 'id',
                searchFormVisible: true,
                showColumns: false,
                search: false,
                dblClickToEdit: false, //是否启用双击编辑
                showExport: false,
                columns: [
                    [
                        {checkbox: true},
                        {field: 'id', title: __('Id'), operate: false, sortable: true},
                        {field: 'businesstype', title: __('Businesstype'), operate: false, searchList: {"个税":__('个税'),"公积金":__('公积金'),"社保":__('社保'),"补充公积金":__('补充公积金')}, formatter: Table.api.formatter.normal, sortable: true},
                        {field: 'paymentdate', title: __('新入年月'), defaultValue: Controller.api.defaultdate(), addclass:'datetimepicker', formatter: Table.api.formatter.search},
                        {field: 'taobaoname', title: __('Taobaoname'), operate: 'LIKE %...%', placeholder: '模糊搜索，*表示任意字符', formatter: Table.api.formatter.search, sortable: true},
                        {field: 'idnumber', title: __('身份证号*'), operate: 'LIKE %...%', placeholder: '模糊搜索，*表示任意字符', formatter: Controller.api.formatter.idnumber},
                        {field: 'kehuname', title: __('Kehu.name'), operate: false},
                        {field: 'kehumobile', title: __('Kehu.mobile'), operate: false, formatter: function (value, row, index) {

                            return [
                                '<a href="javascript:;" class="btn btn-xs">' + value + '</a>'
                            ].join("")

                        }},
                        {
                            field: 'paymentnumber',
                            title: __('缴纳号码*'),
                            editable: {
                                emptytext: '无',
                                disabled: !editagencyfees , //true 则不能编辑 ---- 操作权限
                                success: function (response, newValue) {
                                    //table.bootstrapTable('refresh', {});
                                }
                            },
                        },
                        {field: 'payingcompany', title: __('Payingcompany'), operate: false, formatter: Table.api.formatter.search, sortable: true},
                        {field: 'paymentbase', title: __('Paymentbase'), operate: false, sortable: true, formatter: Controller.api.formatter.paymentbase},
                        {field: 'paymentamount', title: __('Paymentamount'), operate:false, sortable: true},
                        {field: 'agencyfees', title: __('Agencyfees'), operate:false, sortable: true},
                        {
                            field: 'newjoin_note',
                            title: __('新入备注*'),
                            editable: {

                                rows:10,
                                tpl: "<textarea rows='10' cols='50'></textarea>",
                                emptytext: '无',
                                disabled: !editagencyfees , //true 则不能编辑 ---- 操作权限
                                success: function (response, newValue) {
                                    //$(".btn-refresh").trigger("click");
                                }
                            },
                            operate:false,
                        },

                        {field: 'newjoin_status', title:'新入状态*', searchList: {"办理失败":__('办理失败'),"已办理":__('已办理'),"未办理":__('未办理')}, formatter:Controller.api.formatter.xrstatus, sortable: true},
                        {field: 'refundornot', title: __('是否退款*'), operate:false, formatter: Controller.api.formatter.tkstatus2},

                        {field: 'luruman', title: __('录入员'), operate: false, sortable: true},
                        {field: 'auditman', title: __('审核员'), operate: false, sortable: true},
                        {field: 'opman', title: __('操作员'), operate: false, sortable: true},
                        {
                            field: 'payingcompany',
                            title: __('Businesstype') + "|" + __('公司'),
                            visible: false,
                            searchList: function (column) {
                                console.log('1111');
                                console.log(column);
                                return Template('categorytpl', {});
                            }
                        },
                        //{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                    ]
                ]
            });

            //点击新入状态
            $(document).on("dblclick", ".xrstatus[data-id]", function () {

                //console.log("--dblclick--");
                if (editagencyfees && !Config.luru) {
                    var url = 'dahui/dingdan/changexrstatus';
                    var id = $(this).data('id');
                    var _this = $(this);
                    Fast.api.ajax({
                        url: url,
                        data: {ids: id},
                    }, function (data, ret) {
                        console.log(ret.data.changexrstatus);
                        _this.html(ret.data.changexrstatus);
                        if (ret.data.changexrstatus != '已办理') {
                            _this.addClass('text-danger');
                        }  else {
                            _this.removeClass('text-danger')
                        }
                    });
                }

            });

            // 批量新入状态
            $(document).on("click", ".plxrstatus1", function () {
                if (Config.caozuo) {
                    var ids = Table.api.selectedids(table);
                    var url = 'dahui/dingdan/plxrstatus1?ids=' + ids;

                    var that = this;
                    Layer.confirm(__('批量新入状态 => "已办理"?'), {icon: 3, title: '提示'}, function (index) {
                        Backend.api.ajax({
                            url: url,
                        }, function () {
                            Layer.close(index);
                            $(".btn-refresh").trigger("click");
                        });
                    });
                }
            });

            // 批量新入状态
            $(document).on("click", ".plxrstatus2", function () {
                if (Config.caozuo) {
                    var ids = Table.api.selectedids(table);
                    var url = 'dahui/dingdan/plxrstatus2?ids=' + ids;

                    var that = this;
                    Layer.confirm(__('批量新入状态 => "办理失败"?'), {icon: 3, title: '提示'}, function (index) {
                        Backend.api.ajax({
                            url: url,
                        }, function () {
                            Layer.close(index);
                            $(".btn-refresh").trigger("click");
                        });
                    });
                }
            });
            //------

            var form = $("form.form-commonsearch");
            if ($(".datetimepicker", form).size() > 0) {
                require(['bootstrap-datetimepicker'], function () {
                    var options = {
                        format: 'YYYY-MM',
                        icons: {
                            time: 'fa fa-clock-o',
                            date: 'fa fa-calendar',
                            up: 'fa fa-chevron-up',
                            down: 'fa fa-chevron-down',
                            previous: 'fa fa-chevron-left',
                            next: 'fa fa-chevron-right',
                            today: 'fa fa-history',
                            clear: 'fa fa-trash',
                            close: 'fa fa-remove'
                        },
                        showTodayButton: true,
                        showClose: true
                    };
                    $('.datetimepicker', form).parent().css('position', 'relative');
                    $('.datetimepicker', form).datetimepicker(options);
                });
            }

            //导出
            $(document).on("click", ".btn-myexcel-export", function () {
                top.location.href = "import4?filter=" + strfilter + "&op=" + strop;
            });

            $(document).on("dblclick", ".idnumber", function () {
                var url = $(this).data('id');
                window.parent.location.href = url;
            });

            $(document).on("dblclick", ".tkstatus[data-id]", function () {

                if (Config.caozuo || Config.audit) {
                    var url = 'dahui/dingdan/changetstatus2';
                    var id = $(this).data('id');
                    var _this = $(this);
                    Fast.api.ajax({
                        url: url,
                        data: {ids: id},
                    }, function (data, ret) {
                        console.log(ret.data.refundornot);
                        _this.removeClass('text-success')
                        _this.removeClass('text-warning')
                        _this.removeClass('text-danger')
                        if (ret.data.refundornot == '已退款') {
                            _this.addClass('text-success');
                            _this.html(ret.data.refundornot);
                        } else if (ret.data.refundornot == '待退款') {
                            _this.addClass('text-warning');
                            _this.html(ret.data.refundornot);
                        } else if (ret.data.refundornot == '需退款') {
                            _this.addClass('text-danger');
                            _this.html(ret.data.refundornot);
                        } else {
                            _this.html('--');
                        }
                    });
                }

            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        index5: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'dahui/dingdan/index5',
                    add_url: '',
                    edit_url: 'dahui/dingdan/edit5',
                    del_url: '',
                    multi_url: '',
                    table: 'dahui_dingdan5',
                }
            });

            var editagencyfees = false;
            if (Config.caozuo || Config.audit || Config.luru) {
                editagencyfees = true;
            }

            var table = $("#table");

            table.on('post-body.bs.table', function (e, settings, json, xhr) {
                $(".btn-editone").data("area", ["50%", "50%"]);
            });
            //当表格数据加载完成时
            table.on('load-success.bs.table', function (e, data) {
                $("#money").text(data.extend.money);
            });

            var strfilter = "";
            var strop = "";
            //在普通搜索提交搜索前
            table.on('common-search.bs.table', function (event, table, query) {

                var filter = {};//创建空对象
                //拷贝不为空的字段
                for (var key in query.filter) {
                    if (query.filter[key]) {
                        filter[key] = query.filter[key];
                    }
                }
                console.log(filter);

                strfilter = JSON.stringify(filter);
                strop = JSON.stringify(query.op);
                //console.log(query);
            });

            if (strfilter.length < 1) {
                var filter0 = {};
                filter0['paymentdate'] = Controller.api.defaultdate();
                strfilter = JSON.stringify(filter0);
                var op0 = {};
                op0['paymentdate'] = "=";
                strop = JSON.stringify(op0);
            }

            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                showToggle: false,
                sortName: 'id',
                searchFormVisible: true,
                showToggle: false,
                showColumns: false,
                search: false,
                dblClickToEdit: false, //是否启用双击编辑
                showExport: false,
                columns: [
                    [
                        {checkbox: true},
                        {field: 'id', title: __('Id'), operate: false, sortable: true},
                        {field: 'businesstype', title: __('Businesstype'), operate: false, searchList: {"个税":__('个税'),"公积金":__('公积金'),"社保":__('社保'),"补充公积金":__('补充公积金')}, formatter: Table.api.formatter.normal, sortable: true},
                        {field: 'paymentdate2', title: __('转出年月'), operate: false},
                        {field: 'paymentdate', title: __('转出年月'), visible: false, defaultValue: Controller.api.defaultdate(), addclass:'datetimepicker', formatter: Table.api.formatter.search},
                        {field: 'taobaoname', title: __('Taobaoname'), operate: 'LIKE %...%', placeholder: '模糊搜索，*表示任意字符', formatter: Table.api.formatter.search, sortable: true},
                        {field: 'idnumber', title: __('身份证号*'), operate: 'LIKE %...%', placeholder: '模糊搜索，*表示任意字符', formatter: Controller.api.formatter.idnumber},
                        {field: 'kehuname', title: __('Kehu.name'), operate: false},
                        {field: 'kehumobile', title: __('Kehu.mobile'), operate: false, formatter: function (value, row, index) {

                            return [
                                '<a href="javascript:;" class="btn btn-xs">' + value + '</a>'
                            ].join("")

                        }},
                        {field: 'paymentnumber', title: __('缴纳号码'), operate: 'LIKE %...%', placeholder: '模糊搜索，*表示任意字符', formatter: Table.api.formatter.search},
                        {field: 'payingcompany', title: __('Payingcompany'), operate: false, formatter: Table.api.formatter.search, sortable: true},
                        {field: 'paymentbase', title: __('Paymentbase'), operate: false, sortable: true, formatter: Controller.api.formatter.paymentbase},
                        {field: 'paymentamount', title: __('Paymentamount'), operate:false, sortable: true},

                        {field: 'earlytransfer', title: __('提前转出*'), searchList: {"是":__('是'), "否":__('否') }, formatter: Controller.api.formatter.tqzcstatus, sortable: true},
                        {
                            field: 'zc_note',
                            title: __('转出备注*'),
                            editable: {
                                rows:10,
                                tpl: "<textarea rows='10' cols='50'></textarea>",
                                emptytext: '无',
                                disabled: !editagencyfees , //true 则不能编辑 ---- 操作权限
                                success: function (response, newValue) {
                                    //$(".btn-refresh").trigger("click");
                                }
                            },
                            operate:false,
                        },
                        {field: 'xgsrzsj', title: __('新公司入职时间'), operate: false},
                        {field: 'tgsj', title: __('退工时间'), operate: false},

                        {field: 'zc_status', title: __('转出状态*'), searchList: {"办理失败":__('办理失败'),"已办理":__('已办理'),"未办理":__('未办理')}, formatter: Controller.api.formatter.zcstatus},
                        {field: 'newjoindate', title: __('新入年月'), operate: false, defaultValue: Controller.api.defaultdate(), addclass:'datetimepicker', formatter: Table.api.formatter.search},
                        {field: 'luruman', title: __('录入员'), operate: false, sortable: true},
                        {field: 'auditman', title: __('审核员'), operate: false, sortable: true},
                        {field: 'opman', title: __('操作员'), operate: false, sortable: true},
                        {
                            field: 'payingcompany',
                            title: __('Businesstype') + "|" + __('公司'),
                            visible: false,
                            searchList: function (column) {
                                console.log('1111');
                                console.log(column);
                                return Template('categorytpl', {});
                            }
                        },
                        //{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                    ]
                ]
            });

            var form = $("form.form-commonsearch");
            if ($(".datetimepicker", form).size() > 0) {
                require(['bootstrap-datetimepicker'], function () {
                    var options = {
                        format: 'YYYY-MM',
                        icons: {
                            time: 'fa fa-clock-o',
                            date: 'fa fa-calendar',
                            up: 'fa fa-chevron-up',
                            down: 'fa fa-chevron-down',
                            previous: 'fa fa-chevron-left',
                            next: 'fa fa-chevron-right',
                            today: 'fa fa-history',
                            clear: 'fa fa-trash',
                            close: 'fa fa-remove'
                        },
                        showTodayButton: true,
                        showClose: true
                    };
                    $('.datetimepicker', form).parent().css('position', 'relative');
                    $('.datetimepicker', form).datetimepicker(options);
                });
            }

            //点击转出状态
            $(document).on("dblclick", ".zcstatus[data-id]", function () {
                if (editagencyfees && !Config.luru) {
                    var url = 'dahui/dingdan/changezcstatus';
                    var id = $(this).data('id');
                    var _this = $(this);
                    Fast.api.ajax({
                        url: url,
                        data: {ids: id},
                    }, function (data, ret) {
                        console.log(ret.data.zc_status);
                        _this.html(ret.data.zc_status);
                        if (ret.data.zc_status != '已办理') {
                            _this.addClass('text-danger');
                        } else {
                            _this.removeClass('text-danger')
                        }
                    });
                }

            });
            // 批量未办理状态
            $(document).on("click", ".plzcstatus0", function () {
                if (Config.caozuo) {
                    var ids = Table.api.selectedids(table);
                    var url = 'dahui/dingdan/plzcstatus0?ids=' + ids;

                    var that = this;
                    Layer.confirm(__('批量未办理状态 => "未办理"?'), {icon: 3, title: '提示'}, function (index) {
                        Backend.api.ajax({
                            url: url,
                        }, function () {
                            Layer.close(index);
                            $(".btn-refresh").trigger("click");
                        });
                    });
                }
            });
            // 批量转出状态
            $(document).on("click", ".plzcstatus1", function () {
                if (Config.caozuo) {
                    var ids = Table.api.selectedids(table);
                    var url = 'dahui/dingdan/plzcstatus1?ids=' + ids;

                    var that = this;
                    Layer.confirm(__('批量转出状态 => "已办理"?'), {icon: 3, title: '提示'}, function (index) {
                        Backend.api.ajax({
                            url: url,
                        }, function () {
                            Layer.close(index);
                            $(".btn-refresh").trigger("click");
                        });
                    });
                }
            });

            // 批量转出状态
            $(document).on("click", ".plzcstatus2", function () {
                if (Config.caozuo) {
                    var ids = Table.api.selectedids(table);
                    var url = 'dahui/dingdan/plzcstatus2?ids=' + ids;

                    var that = this;
                    Layer.confirm(__('批量转出状态 => "办理失败"?'), {icon: 3, title: '提示'}, function (index) {
                        Backend.api.ajax({
                            url: url,
                        }, function () {
                            Layer.close(index);
                            $(".btn-refresh").trigger("click");
                        });
                    });
                }
            });
            //------

            //点击提前转出状态
            $(document).on("dblclick", ".tqzcstatus[data-id]", function () {
                if (editagencyfees) {
                    var url = 'dahui/dingdan/changetqzcstatus';
                    var id = $(this).data('id');
                    var _this = $(this);
                    Fast.api.ajax({
                        url: url,
                        data: {ids: id},
                    }, function (data, ret) {

                        //否','是'
                        console.log(ret.data.earlytransfer);
                        if (ret.data.earlytransfer == '是') {
                            _this.addClass('text-danger');
                            _this.html(ret.data.earlytransfer);
                        }  else {
                            _this.removeClass('text-danger')
                            _this.html('--');
                        }
                    });
                }
            });

            //导出
            $(document).on("click", ".btn-myexcel-export", function () {
                top.location.href = "import5?filter=" + strfilter + "&op=" + strop;
            });

            $(document).on("dblclick", ".idnumber", function () {
                var url = $(this).data('id');
                window.parent.location.href = url;
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        index6: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'dahui/dingdan/index6',
                    add_url: '',
                    edit_url: 'dahui/dingdan/edit6',
                    del_url: '',
                    multi_url: '',
                    table: 'dahui_dingdan5',
                }
            });

            var table = $("#table");

            table.on('post-body.bs.table', function (e, settings, json, xhr) {
                $(".btn-editone").data("area", ["50%", "50%"]);
            });

            //当表格数据加载完成时
            table.on('load-success.bs.table', function (e, data) {
                $("#money").text(data.extend.money);
            });

            var strfilter = "";
            var strop = "";
            //在普通搜索提交搜索前
            table.on('common-search.bs.table', function (event, table, query) {

                var filter = {};//创建空对象
                //拷贝不为空的字段
                for (var key in query.filter) {
                    if (query.filter[key]) {
                        filter[key] = query.filter[key];
                    }
                }
                console.log(filter);

                strfilter = JSON.stringify(filter);
                strop = JSON.stringify(query.op);
                //console.log(query);
            });

            if (strfilter.length < 1) {
                var filter0 = {};
                filter0['paymentdate'] = Controller.api.defaultdate();
                strfilter = JSON.stringify(filter0);
                var op0 = {};
                op0['paymentdate'] = "=";
                strop = JSON.stringify(op0);
            }

            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                showToggle: false,
                sortName: 'id',
                searchFormVisible: true,
                showToggle: false,
                showColumns: false,
                search: false,
                dblClickToEdit: false, //是否启用双击编辑
                showExport: false,
                columns: [
                    [
                        //{checkbox: true},
                        //{field: 'id', title: __('Id'), operate: false, sortable: true},
                        {field: 'businesstype', title: __('Businesstype'), operate: false, searchList: {"个税":__('个税'),"公积金":__('公积金'),"社保":__('社保'),"补充公积金":__('补充公积金')}, formatter: Table.api.formatter.normal, sortable: true},
                        {field: 'paymentdate', title: __('缴纳年月'), defaultValue: Controller.api.defaultdate(), addclass:'datetimepicker', formatter: Table.api.formatter.search},
                        {field: 'taobaoname', title: __('Taobaoname'), operate: 'LIKE %...%', placeholder: '模糊搜索，*表示任意字符', formatter: Table.api.formatter.search, sortable: true},
                        {field: 'idnumber', title: __('身份证号*'), operate: 'LIKE %...%', placeholder: '模糊搜索，*表示任意字符', formatter: Controller.api.formatter.idnumber},
                        {field: 'kehuname', title: __('Kehu.name'), operate: false},
                        {field: 'kehumobile', title: __('Kehu.mobile'), operate: false, formatter: function (value, row, index) {

                            return [
                                '<a href="javascript:;" class="btn btn-xs">' + value + '</a>'
                            ].join("")

                        }},
                        {field: 'paymentnumber', title: __('缴纳号码'), operate: 'LIKE %...%', placeholder: '模糊搜索，*表示任意字符', formatter: Table.api.formatter.search},
                        {field: 'payingcompany', title: __('Payingcompany'), operate: false, formatter: Table.api.formatter.search, sortable: true},
                        {field: 'paymentbase', title: __('Paymentbase'), operate: false, sortable: true, formatter: Controller.api.formatter.paymentbase},
                        {field: 'paymentamount', title: __('Paymentamount'), operate:false, sortable: true},
                        {field: 'refundornot', title: __('退款状态'), searchList: {"已退款":__('已退款'),"待退款":__('待退款')}, formatter:Controller.api.formatter.tkstatus, sortable: true},
                        {field: 'luruman', title: __('录入员'), operate: false, sortable: true},
                        {field: 'auditman', title: __('审核员'), operate: false, sortable: true},
                        {field: 'opman', title: __('操作员'), operate: false, sortable: true},
                        {
                            field: 'payingcompany',
                            title: __('Businesstype') + "|" + __('公司'),
                            visible: false,
                            searchList: function (column) {
                                console.log('1111');
                                console.log(column);
                                return Template('categorytpl', {});
                            }
                        },
                        //{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                    ]
                ]
            });

            //点击退款状态
            $(document).on("dblclick", ".tkstatus[data-id]", function () {

                //|| Config.caozuo
                if (Config.audit) {
                    var url = 'dahui/dingdan/changetstatus3';
                    var id = $(this).data('id');
                    var _this = $(this);
                    Fast.api.ajax({
                        url: url,
                        data: {ids: id},
                    }, function (data, ret) {
                        console.log(ret.data.refundornot);
                        _this.removeClass('text-success')
                        _this.removeClass('text-warning')
                        _this.removeClass('text-danger')
                        if (ret.data.refundornot == '已退款') {
                            _this.addClass('text-success');
                            _this.html(ret.data.refundornot);
                        } else if (ret.data.refundornot == '待退款') {
                            _this.addClass('text-warning');
                            _this.html(ret.data.refundornot);
                        } else if (ret.data.refundornot == '需退款') {
                            _this.addClass('text-danger');
                            _this.html(ret.data.refundornot);
                        } else {
                            _this.html('--');
                        }

                    });
                } else if (Config.tuikuan) {
                    var url = 'dahui/dingdan/changetstatus4';
                    var id = $(this).data('id');
                    var _this = $(this);
                    Fast.api.ajax({
                        url: url,
                        data: {ids: id},
                    }, function (data, ret) {
                        console.log(ret.data.refundornot);
                        _this.removeClass('text-success')
                        _this.removeClass('text-warning')
                        _this.removeClass('text-danger')
                        if (ret.data.refundornot == '已退款') {
                            _this.addClass('text-success');
                            _this.html(ret.data.refundornot);
                        } else if (ret.data.refundornot == '待退款') {
                            _this.addClass('text-warning');
                            _this.html(ret.data.refundornot);
                        } else if (ret.data.refundornot == '需退款') {
                            _this.addClass('text-danger');
                            _this.html(ret.data.refundornot);
                        } else {
                            _this.html('--');
                        }

                    });
                }



            });

            var form = $("form.form-commonsearch");
            if ($(".datetimepicker", form).size() > 0) {
                require(['bootstrap-datetimepicker'], function () {
                    var options = {
                        format: 'YYYY-MM',
                        icons: {
                            time: 'fa fa-clock-o',
                            date: 'fa fa-calendar',
                            up: 'fa fa-chevron-up',
                            down: 'fa fa-chevron-down',
                            previous: 'fa fa-chevron-left',
                            next: 'fa fa-chevron-right',
                            today: 'fa fa-history',
                            clear: 'fa fa-trash',
                            close: 'fa fa-remove'
                        },
                        showTodayButton: true,
                        showClose: true
                    };
                    $('.datetimepicker', form).parent().css('position', 'relative');
                    $('.datetimepicker', form).datetimepicker(options);
                });
            }

            //导出
            $(document).on("click", ".btn-myexcel-export", function () {
                top.location.href = "import6?filter=" + strfilter + "&op=" + strop;
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        index7: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'dahui/dingdan/index7',
                    add_url: '',
                    edit_url: 'dahui/dingdan/edit7',
                    del_url: '',
                    multi_url: '',
                    table: 'dahui_dingdan4',
                }
            });

            var table = $("#table");
            table.on('post-body.bs.table', function (e, settings, json, xhr) {
                $(".btn-editone").data("area", ["50%", "50%"]);
            });
            //业务+年月
            //当表格数据加载完成时
            table.on('load-success.bs.table', function (e, data) {
                $("#money").text(data.extend.money);
            });

            var strfilter = "";
            var strop = "";
            //在普通搜索提交搜索前
            table.on('common-search.bs.table', function (event, table, query) {

                var filter = {};//创建空对象
                //拷贝不为空的字段
                for (var key in query.filter) {
                    if (query.filter[key]) {
                        filter[key] = query.filter[key];
                    }
                }
                console.log(filter);

                strfilter = JSON.stringify(filter);
                strop = JSON.stringify(query.op);
                //console.log(query);
            });

            if (strfilter.length < 1) {
                var filter0 = {};
                filter0['paymentdate'] = Controller.api.defaultdate();
                strfilter = JSON.stringify(filter0);
                var op0 = {};
                op0['paymentdate'] = "=";
                strop = JSON.stringify(op0);
            }

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                showToggle: false,
                sortName: 'id',
                searchFormVisible: true,
                showToggle: false,
                showColumns: false,
                search: false,
                dblClickToEdit: false, //是否启用双击编辑
                showExport: false,
                columns: [
                    [
                        //{checkbox: true},
                        //{field: 'id', title: __('Id'), operate: false, sortable: true},
                        {field: 'businesstype', title: __('Businesstype'), operate: false, searchList: {"个税":__('个税'),"公积金":__('公积金'),"社保":__('社保'),"补充公积金":__('补充公积金')}, formatter: Table.api.formatter.normal, sortable: true},
                        {field: 'paymentdate', title: __('缴纳年月'), defaultValue: Controller.api.defaultdate(), addclass:'datetimepicker', formatter: Table.api.formatter.search},
                        {field: 'taobaoname', title: __('Taobaoname'), operate: 'LIKE %...%', placeholder: '模糊搜索，*表示任意字符', formatter: Table.api.formatter.search, sortable: true},
                        {field: 'idnumber', title: __('身份证号*'), operate: 'LIKE %...%', placeholder: '模糊搜索，*表示任意字符', formatter: Controller.api.formatter.idnumber},
                        {field: 'kehuname', title: __('Kehu.name'), operate: false},
                        {field: 'kehumobile', title: __('Kehu.mobile'), operate: false, formatter: function (value, row, index) {

                            return [
                                '<a href="javascript:;" class="btn btn-xs">' + value + '</a>'
                            ].join("")

                        }},
                        {field: 'paymentnumber', title: __('缴纳号码'), operate: false},
                        {field: 'payingcompany', title: __('Payingcompany'), operate: false, formatter: Table.api.formatter.search, sortable: true},
                        {field: 'paymentbase', title: __('Paymentbase'), operate: false, sortable: true, formatter: Controller.api.formatter.paymentbase},
                        {field: 'paymentamount', title: __('Paymentamount'), operate:false, sortable: true},
                        {field: 'agencyfees', title: __('Agencyfees'), operate:false, sortable: true},
                        {field: 'newjoin_note', title: __('新入备注'), operate:false},

                        {
                            field: 'wenti_note',
                            title: __('问题备注*'),
                            editable: {

                                rows:10,
                                tpl: "<textarea rows='10' cols='50'></textarea>",
                                emptytext: '无',
                                disabled: !Config.audit , //true 则不能编辑 ---- 操作权限
                                success: function (response, newValue) {
                                    //$(".btn-refresh").trigger("click");
                                }
                            },
                            operate: false
                        },

                        {field: 'newjoin_status', title:'新入状态', operate: false, formatter:Controller.api.formatter.xrstatus},

                        {field: 'refundornot', title: __('退款状态'), searchList: {"需退款":__('需退款')}, formatter:Controller.api.formatter.tkstatus, sortable: true},

                        //wenti_note
                        //{field: 'luruman', title: __('录入员'), operate: false, sortable: true},
                        {field: 'auditman', title: __('审核员'), operate: false, sortable: true},
                        //{field: 'opman', title: __('操作员'), operate: false, sortable: true},
                        {
                            field: 'payingcompany',
                            title: __('Businesstype') + "|" + __('公司'),
                            visible: false,
                            searchList: function (column) {
                                console.log('1111');
                                console.log(column);
                                return Template('categorytpl', {});
                            }
                        },
                        //{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                    ]
                ]
            });

            //点击退款状态
            $(document).on("dblclick", ".tkstatus[data-id]", function () {

                //|| Config.caozuo
                if (Config.audit || Config.caozuo) {
                    var url = 'dahui/dingdan/changetstatus2';
                    var id = $(this).data('id');
                    var _this = $(this);
                    Fast.api.ajax({
                        url: url,
                        data: {ids: id},
                    }, function (data, ret) {
                        console.log(ret.data.refundornot);
                        _this.removeClass('text-success')
                        _this.removeClass('text-warning')
                        _this.removeClass('text-danger')
                        if (ret.data.refundornot == '已退款') {
                            _this.addClass('text-success');
                            _this.html(ret.data.refundornot);
                        } else if (ret.data.refundornot == '待退款') {
                            _this.addClass('text-warning');
                            _this.html(ret.data.refundornot);
                        } else if (ret.data.refundornot == '需退款') {
                            _this.addClass('text-danger');
                            _this.html(ret.data.refundornot);
                        } else {
                            _this.html('--');
                        }
                    });
                }

            });

            var form = $("form.form-commonsearch");
            if ($(".datetimepicker", form).size() > 0) {
                require(['bootstrap-datetimepicker'], function () {
                    var options = {
                        format: 'YYYY-MM',
                        icons: {
                            time: 'fa fa-clock-o',
                            date: 'fa fa-calendar',
                            up: 'fa fa-chevron-up',
                            down: 'fa fa-chevron-down',
                            previous: 'fa fa-chevron-left',
                            next: 'fa fa-chevron-right',
                            today: 'fa fa-history',
                            clear: 'fa fa-trash',
                            close: 'fa fa-remove'
                        },
                        showTodayButton: true,
                        showClose: true
                    };
                    $('.datetimepicker', form).parent().css('position', 'relative');
                    $('.datetimepicker', form).datetimepicker(options);
                });
            }

            //导出
            $(document).on("click", ".btn-myexcel-export", function () {
                top.location.href = "import7?filter=" + strfilter + "&op=" + strop;
            });

            $(document).on("dblclick", ".idnumber", function () {
                var url = $(this).data('id');
                window.parent.location.href = url;
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        tbyewu: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url2: 'dahui/dingdan/tbyewu?taobaoname=' + Config.taobaoname + '&idnumber=' + Config.idnumber,
                    index_url3: 'dahui/dingdan/tbyewu2?idnumber=' + Config.idnumber,
                    add_url: '',
                    edit_url: '',
                    del_url: '',
                    multi_url: '',
                    table: 'dahui_tbyewu',
                }
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url2,
                pk: 'id',
                sortName: 'id',
                search:false,
                showToggle: false,
                showColumns: false,
                commonSearch: false,
                showExport: false,
                pageSize: 'All',
                pageList: ['All'],
                onDblClickCell: function (field, value, row, $element) {
                    //alert(JSON.stringify(row));
                    var url = 'dahui/dingdan/addhis?ids=' + row.id;
                    Backend.api.ajax({
                        url: url
                    }, function (data, ret) {
                        Fast.api.close(data);
                        return false;
                    });
                },
                columns: [
                    [
                        //{
                        //    field: 'buttons',
                        //    width: "60px",
                        //    title: __('操作'),
                        //    table: table,
                        //    events: Table.api.events.operate,
                        //    buttons: [
                        //        {
                        //            name: '加入',
                        //            text: __('加入'),
                        //            title: __('加入选中业务'),
                        //            classname: 'btn btn-xs btn-success btn-magic btn-ajax',
                        //            icon: 'fa fa-magic',
                        //            url: 'dahui/dingdan/addhis',
                        //            success: function (data, ret) {
                        //                //Layer.alert(ret.msg + ",返回数据：" + JSON.stringify(data));
                        //                //如果需要阻止成功提示，则必须使用return false;
                        //                Fast.api.close(data);
                        //                return false;
                        //            },
                        //            error: function (data, ret) {
                        //                console.log(data, ret);
                        //                Layer.alert(ret.msg);
                        //                return false;
                        //            }
                        //        }
                        //    ],
                        //    formatter: Table.api.formatter.buttons
                        //},
                        {field: 'id', title: __('Id')},
                        //业务类型,身份证号,客户姓名,客户电话,缴纳号码,付代理费；缴纳公司，缴纳基数，缴纳金额，缴纳年月
                        {field: 'businesstype', title: __('Businesstype'), searchList: {"个税":__('个税'),"公积金":__('公积金'),"社保":__('社保'),"补充公积金":__('补充公积金')}, formatter: Table.api.formatter.normal},
                        {field: 'idnumber', title: __('身份证号*')},
                        {field: 'kehu.name', title: __('客户姓名')},
                        {field: 'kehu.mobile', title: __('客户电话'), formatter: function (value, row, index) {

                            return [
                                '<a href="javascript:;" class="btn btn-xs">' + value + '</a>'
                            ].join("")

                        }},
                        {field: 'paymentnumber', title: __('Paymentnumber')},
                        {field: 'nianyue.payingcompany', title: __('缴纳公司')},
                        {field: 'nianyue.paymentbase', title: __('缴纳基数')},
                        {field: 'nianyue.paymentamount', title: __('缴纳金额')},
                        {field: 'nianyue.paymentdate', title: __('最近缴纳年月')},
                        {field: 'agencyfees', title: __('付代理费')},
                        {field: 'zc_log', title: __('最近转出年月'), formatter: function (value, row, index) {
                            return [
                                '<a href="javascript:;" class="text-danger" > ' + value + '</a>'
                            ].join("")
                        }},
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);


            var table2 = $("#table2");

            // 初始化表格
            table2.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url3,
                pk: 'id',
                sortName: 'id',
                search:false,
                showToggle: false,
                showColumns: false,
                commonSearch: false,
                showExport: false,
                pageSize: 'All',
                pageList: ['All'],
                columns: [
                    [
                        {field: 'businesstype', title: __('Businesstype'), searchList: {"个税":__('个税'),"公积金":__('公积金'),"社保":__('社保'),"补充公积金":__('补充公积金')}, formatter: Table.api.formatter.normal},
                        {field: 'payingcompany', title: __('缴纳公司')},
                        {field: 'paymentdate', title: __('最近缴纳年月')},
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table2);
            //Form.api.bindevent($("form[role=form]"), function (data, ret) {
            //    //这里是表单提交处理成功后的回调函数，接收来自php的返回数据
            //    Fast.api.close(data);//这里是重点
            //    Toastr.success("成功");//这个可有可无
            //}, function (data, ret) {
            //    Toastr.success("失败");
            //});

        },
        add0: function (isedit) {

            if (isedit) {
                //updatecompany();
            }
            //updateinfo();

            function updatecompany() {
                var businesstype = $("#c-businesstype").val();
                $("#c-payingcompany").empty();
                $("#c-payingcompany").append('<option value= ""></option>');
                $.each(cdata.companyList, function (i, item) {
                    if (item.businesstype === businesstype) {
                        $("#c-payingcompany").append('<option value="' + item.name + '" >' + item.name + '</option>');
                        //<option value="{$key}" {in name="key" value="$row.payingcompany"}selected{/in}>{$vo}</option>
                    }
                });
            }

            function updateinfo() {
                var businesstype = $("#c-businesstype").val();
                var company = $("#c-payingcompany").val();
                $.each(cdata.companyList, function (i, item) {
                    if (item.name === company && item.businesstype === businesstype) {
                        $("#c-paymentbase").val(item.minimumcardinality);
                        var num = item.minimumcardinality * item.proportion;
                        if (businesstype == '社保') {
                            num = Math.round(num * 10) / 10;
                        } else {
                            num = Math.round(num);
                        }
                        $("#c-paymentamount").val(num);
                        return false;
                    }
                });
            }

            $(document).on("change", "#c-businesstype", function () {
                $("#c-paymentbase").val('');
                $("#c-paymentamount").val('');
                $("#c-paymentamount").val('');

                var thismonth = Controller.api.defaultdate();
                $("#c-paymentdate").val(thismonth);
                $("#c-paymentdate2").val(thismonth);

                updatecompany();
                $("#c-payingcompany").selectpicker("refresh");
                updateinfo();
            });

            $(document).on("change", "#c-payingcompany", function () {
                updateinfo();
            });

            $(document).on("change", "#c-paymentbase", function () {
                var paymentbase = $("#c-paymentbase").val();
                var businesstype = $("#c-businesstype").val();
                var company = $("#c-payingcompany").val();
                $.each(cdata.companyList, function (i, item) {
                    if (item.name === company && item.businesstype === businesstype) {
                        var num = paymentbase * item.proportion;
                        if (businesstype == '社保') {
                            num = Math.round(num * 10) / 10;
                        } else {
                            num = Math.round(num);
                        }
                        $("#c-paymentamount").val(num);
                        return false;
                    }
                });
            });

            document.getElementById('c-idnumber').addEventListener('paste', function (e) {
                if ( !(e.clipboardData && e.clipboardData.items) ) {
                    return;
                }
                for (var i = 0, len = e.clipboardData.items.length; i < len; i++) {
                    var item = e.clipboardData.items[i];

                    if (item.kind === "string") {
                        item.getAsString(function (str) {
                            console.log("paste1----" + str);
                            var idnumber = str.trim();
                            if (idnumber.length < 20 && Controller.api.validateIdCard(idnumber)) {
                                $("#c-idnumber").val(idnumber);
                                console.log("paste2----" + idnumber);
                                $.ajax({
                                    url: 'dahui/dingdan/getkehu',
                                    type: 'post',
                                    data: {
                                        idnumber: idnumber
                                    },
                                    dataType: 'json',
                                    success: function (ret) {
                                        $("#c-name").val(ret.data.name);
                                        $("#c-mobile").val(ret.data.mobile);
                                        $("#c-paymentnumber").val(ret.data.paymentnumber.toUpperCase());
                                    }
                                });

                                checklaokehu();
                            }
                        })
                    } else if (item.kind === "file") {
                        //var f= item.getAsFile();
                        //console.log(f);
                    }
                    break;
                }
            });

            $(document).on("change", "#c-idnumber", function () {
                var idnumber = $("#c-idnumber").val();
                idnumber = idnumber.trim();
                if (Controller.api.validateIdCard(idnumber)) {
                    $("#c-idnumber").val(idnumber);
                    $.ajax({
                        url: 'dahui/dingdan/getkehu',
                        type: 'post',
                        data: {
                            idnumber:idnumber
                        },
                        dataType: 'json',
                        success: function (ret) {
                            $("#c-name").val(ret.data.name);
                            $("#c-mobile").val(ret.data.mobile);
                            $("#c-paymentnumber").val(ret.data.paymentnumber);
                        }
                    });

                    checklaokehu();
                } else {
                    $("#c-idnumber").val(idnumber + '##');
                }

            });
            $("#c-idnumber").keypress(function (e) {
                if (e.which == 13) {
                    var idnumber = $("#c-idnumber").val();
                    idnumber = idnumber.trim();
                    if (Controller.api.validateIdCard(idnumber))  {
                        var url = "/admin/dahui/dingdan/tbyewu?idnumber=" + idnumber;
                        var options = {
                            shadeClose: false,
                            shade: [0.3, '#393D49'],
                            area: ["80%", "80%"],
                            callback:function(data){
                                //CallBackFun(value.id, value.name);//在回调函数里可以调用你的业务代码实现前端的各种逻辑和效果
                                //$("#c-taobaoname").val("");
                                console.log(data);

                                $("#c-idnumber").val(data.idnumber.toUpperCase());
                                $("#c-name").val(data.kehu.name);
                                $("#c-mobile").val(data.kehu.mobile);
                                $("#c-paymentnumber").val(data.paymentnumber.toUpperCase());
                                $("#c-paymentbase").val(data.nianyue.paymentbase);
                                $("#c-paymentamount").val(data.nianyue.paymentamount);

                                $("#c-taobaoname").val(data.nianyue.taobaoname);

                                $("#c-idnumber").focusout();//移除焦点
                                
                                $("#c-businesstype0").val(data.businesstype);
                                $("#c-payingcompany0").val(data.nianyue.payingcompany);

                                $("#c-agencyfees").val(data.agencyfees);

                                updatecompany2();
                                checklaokehu();
                            }
                        };
                        console.log(url);
                        Fast.api.open(url, idnumber+"的历史业务", options);
                    }
                }
            });

            $("#c-taobaoname").keypress(function (e) {
                if (e.which == 13) {
                    var taobaoname = $("#c-taobaoname").val();
                    if (taobaoname.length > 1) {
                        var url = "/admin/dahui/dingdan/tbyewu?taobaoname=" + taobaoname;
                        var options = {
                            shadeClose: false,
                            shade: [0.3, '#393D49'],
                            area: ["80%", "80%"],
                            callback:function(data){
                                //CallBackFun(value.id, value.name);//在回调函数里可以调用你的业务代码实现前端的各种逻辑和效果
                                console.log(data);

                                $("#c-idnumber").val(data.idnumber.toUpperCase());
                                $("#c-name").val(data.kehu.name);
                                $("#c-mobile").val(data.kehu.mobile);
                                $("#c-paymentnumber").val(data.paymentnumber.toUpperCase());
                                $("#c-paymentbase").val(data.nianyue.paymentbase);
                                $("#c-paymentamount").val(data.nianyue.paymentamount);

                                $("#c-taobaoname").val(data.nianyue.taobaoname);
                                $("#c-idnumber").focusout();//移除焦点

                                $("#c-businesstype0").val(data.businesstype);
                                $("#c-payingcompany0").val(data.nianyue.payingcompany);

                                $("#c-agencyfees").val(data.agencyfees);


                                updatecompany2();
                                checklaokehu();
                            }
                        };
                        Fast.api.open(url, taobaoname+"的历史业务", options);
                    }
                }
            });

            function updatecompany2() {
                var payingcompany0 = $("#c-payingcompany0").val();
                var businesstype = $("#c-businesstype0").val();

                console.log(payingcompany0, businesstype);
                $("#c-businesstype").empty();
                $.each(cdata.businesstypeList, function (i, item) {
                    if (item === businesstype) {
                        $("#c-businesstype").append('<option value="' + item + '" selected >' + item + '</option>');
                    } else {
                        $("#c-businesstype").append('<option value="' + item + '" >' + item + '</option>');
                    }
                });
                $("#c-businesstype").selectpicker("refresh");

                $("#c-payingcompany").empty();
                $.each(cdata.companyList, function (i, item) {
                    if (item.businesstype === businesstype) {
                        if (payingcompany0 == item.name) {
                            $("#c-payingcompany").append('<option value="' + item.name + '" selected >' + item.name + '</option>');
                        } else {
                            $("#c-payingcompany").append('<option value="' + item.name + '" >' + item.name + '</option>');
                        }
                    }
                });
                $("#c-payingcompany").selectpicker("refresh");

            }

            function checklaokehu() {
                var idnumber = $("#c-idnumber").val();
                var businesstype = $("#c-businesstype").val();

                if (idnumber && businesstype) {
                    var url = 'dahui/dingdan/islaokehu?idnumber=' + idnumber + "&businesstype=" + businesstype;

                    Backend.api.ajax({
                        url: url,
                    }, function (data, ret) {
                        //console.log("islaokehu--" + data);
                        if (data) {
                            $("#c-laokehutishi").html("提示：续费客户|" + businesstype + "|" + idnumber);
                        } else {
                            $("#c-laokehutishi").html("");
                        }
                        return false;
                    });
                }

            }

            $('#c-paymentdate').on('dp.change', function (e) {
                var paymentdate = $("#c-paymentdate").val();
                var paymentdate2 = $("#c-paymentdate2").val();
                if (paymentdate > paymentdate2) {
                    $("#c-paymentdate2").val(paymentdate);
                }
            });

            //document.getElementById('c-mobile').addEventListener('paste', function (e) {
            //    if ( !(e.clipboardData && e.clipboardData.items) ) {
            //        return;
            //    }
            //    for (var i = 0, len = e.clipboardData.items.length; i < len; i++) {
            //        var item = e.clipboardData.items[i];
            //
            //        if (item.kind === "string") {
            //            item.getAsString(function (str) {
            //                console.log("paste1----" + str);
            //                var mobile = str.trim();
            //                if (mobile.length < 12) {
            //                    $("#c-mobile").val(mobile);
            //                }
            //            })
            //        } else if (item.kind === "file") {
            //            //var f= item.getAsFile();
            //            //console.log(f);
            //        }
            //        break;
            //    }
            //});

        },
        add: function () {

            Controller.add0(false);
            $("#c-submit").click(function (e) {
                //不是所有的input都提交
                //Backend.api.toastr.success("提交");
                var formdata = $("#add-form").serialize();
                var x = $("#add-form").serializeArray();
                var row = new Array();
                var ispreprocessing = false;
                $.each(x, function (i, field) {
                    row[field.name] = field.value;
                    if (field.name == "row[preprocessing]" && field.value == "是") {
                        ispreprocessing = true;
                        console.log("123");
                    }
                    //console.log(field);
                });

                if (row["row[paymentdate]"] !== '' && row["row[paymentdate]"] > row["row[paymentdate2]"]) {
                    //console.log("paymentdate2");
                    Backend.api.toastr.error("缴纳年月结束小于缴纳年月开始, 请重新设置！");
                    return;
                }

                if (!ispreprocessing) {
                    console.log(row["row[idnumber]"]);
                    if (!Controller.api.validateIdCard(row["row[idnumber]"])) {
                        Backend.api.toastr.error("无效的身份证！");
                        return;
                    }

                    if (!row["row[taobaoname]"]) {
                        Backend.api.toastr.error("淘宝名称不能为空");
                        return;
                    }

                    //console.log(row["row[paymentdate]"]);
                    //console.log(row["row[paymentdate2]"]);
                    if (!row["row[businesstype]"]) {
                        Backend.api.toastr.error("请选择业务类型！");
                        return;
                    }

                    if (!row["row[payingcompany]"]) {
                        Backend.api.toastr.error("请选择缴纳公司！");
                        return;
                    }

                    //if (!row["row[paymentnumber]"]) {
                    //    Backend.api.toastr.error("缴纳号码不能为空");
                    //    return;
                    //}
                }

                console.log(row);

                var url = 'dahui/dingdan/saveadd';
                //console.log(formdata);

                Backend.api.ajax({
                    url: url,
                    data: formdata
                }, function (data, ret) {
                    //Backend.api.toastr.success(data);
                    $("#c-paymentbase").val('');
                    $("#c-paymentamount").val('');

                    $("#c-payingcompany0").val('');
                    $("#c-businesstype0").val('');

                    $("#c-businesstype").empty();
                    $("#c-businesstype").append('<option value="" ></option>');
                    $.each(cdata.businesstypeList, function (i, item) {
                        $("#c-businesstype").append('<option value="' + item + '" >' + item + '</option>');
                    });
                    $("#c-businesstype").selectpicker("refresh");

                    $("#c-payingcompany").empty();
                    $("#c-payingcompany").selectpicker("refresh");

                    var thismonth = Controller.api.defaultdate();
                    $("#c-paymentdate").val(thismonth);
                    $("#c-paymentdate2").val(thismonth);

                    $("#c-agencyfees").val("");
                    $("#c-ordercomment").val("");

                    $("input:checkbox").each(function () {
                        $(this).prop("checked", false);
                    });

                    //$(".btn-refresh").trigger("click");
                    //window.opener.location.reload();

                    //return false;
                });

            });

            $("#c-close").click(function (e) {
                parent.location.reload();
            });

            Controller.api.bindevent();
        },
        edit: function () {
            Controller.add0(true);
            Controller.api.bindevent();
        },
        audit: function () {
            Controller.add0(true);
            Controller.api.bindevent();
        },
        edit1: function () {
            Controller.api.bindevent();
        },
        edit2: function () {
            Controller.api.bindevent();
        },
        edit3: function () {
            Controller.api.bindevent();
        },
        edit4: function () {
            Controller.api.bindevent();
        },
        edit5: function () {
            Controller.api.bindevent();
        },
        edit6: function () {
            Controller.api.bindevent();
        },
        editkehunote: function () {
            Controller.api.bindevent();
            $(document).on('click', '.khbz', function () {
                var data = $("#c-note").val();
                //确实从这里传入
                Fast.api.close(data);
            });
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
                //console.log('bindevent');
                //Form.api.bindevent($("form[role=form]"), function (data, ret) {
                //    //如果我们需要在提交表单成功后做跳转，可以在此使用location.href="链接";进行跳转
                //    Toastr.success("成功");
                //    console.log(data, ret);
                //}, function (data, ret) {
                //    Toastr.success("失败");
                //    console.log(data, ret);
                //}, function (success, error) {
                //    //bindevent的第三个参数为提交前的回调
                //    //如果我们需要在表单提交前做一些数据处理，则可以在此方法处理
                //    //注意如果我们需要阻止表单，可以在此使用return false;即可
                //    //如果我们处理完成需要再次提交表单则可以使用submit提交,如下
                //    //Form.api.submit(this, success, error);
                //    console.log(success, error);
                //    return false;
                //});
            },
            events: {//绑定事件的方法
                operate: {
                    'click .btn-editone': function (e, value, row, index) {
                        e.stopPropagation();
                        e.preventDefault();
                        var table = $(this).closest('table');
                        var options = table.bootstrapTable('getOptions');
                        var ids = row[options.pk];
                        row = $.extend({}, row ? row : {}, {ids: ids});
                        var url = options.extend.edit_url;
                        Fast.api.open(Table.api.replaceurl(url, row, table), __('Edit'), $(this).data() || {});
                    },
                    'click .btn-auditone': function (e, value, row, index) {
                        e.stopPropagation();
                        e.preventDefault();
                        var table = $(this).closest('table');
                        var options = table.bootstrapTable('getOptions');
                        var ids = row[options.pk];
                        row = $.extend({}, row ? row : {}, {ids: ids});
                        var url = options.extend.audit_url;
                        Fast.api.open(Table.api.replaceurl(url, row, table), __('审核'), $(this).data() || {});
                    },
                    'click .btn-delone': function (e, value, row, index) {
                        e.stopPropagation();
                        e.preventDefault();
                        var that = this;
                        var top = $(that).offset().top - $(window).scrollTop();
                        var left = $(that).offset().left - $(window).scrollLeft() - 260;
                        if (top + 154 > $(window).height()) {
                            top = top - 154;
                        }
                        if ($(window).width() < 480) {
                            top = left = undefined;
                        }
                        Layer.confirm(
                            __('Are you sure you want to delete this item?'),
                            {icon: 3, title: __('Warning'), offset: [top, left], shadeClose: true},
                            function (index) {
                                var table = $(that).closest('table');
                                var options = table.bootstrapTable('getOptions');
                                Table.api.multi("del", row[options.pk], table, that);
                                Layer.close(index);
                            }
                        );
                    }
                },
                audit: {
                    //格式为：方法名+空格+DOM元素
                    'click .btn-audit': function (e, value, row, index) {

                        var auditstatus = $(".btn-audit").html();
                        if (row.auditstatus == '已审核' || Config.audit != true || auditstatus == '已审核') {

                        } else {
                            $.ajax({
                                url: 'dahui/dingdan/audit',
                                type: 'post',
                                data: {
                                    ids:row.id
                                },
                                dataType: 'json',
                                success: function (ret) {
                                    Toastr.info("审核成功！");
                                    //$(".btn-audit").html('已审核');
                                    //$(".btn-audit").removeClass("btn-audit");
                                    var table = $("#table");
                                    table.bootstrapTable('refresh', {});
                                }
                            });
                        }
                    }
                },
            },
            defaultdate: function () {
                var date = new Date();
                var year = date.getFullYear();
                var month = date.getMonth() + 1;//获取当前月份(0-11,0代表1月)
                if (month >= 10) {
                    month = "" + month;
                } else {
                    month = "0" + month;
                }
                //console.log("QQQ---" + year + "-" + month);
                return year + "-" + month;
            },
            validateIdCard: function (idCard) {
                idCard = idCard.trim();
                var regIdCard = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/;

                //如果通过该验证，说明身份证格式正确，但准确性还需计算
                if (regIdCard.test(idCard)) {
                    if (idCard.length == 18) {
                        var idCardWi = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2); //将前17位加权因子保存在数组里
                        var idCardY = new Array(1, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2); //这是除以11后，可能产生的11位余数、验证码，也保存成数组
                        var idCardWiSum = 0; //用来保存前17位各自乖以加权因子后的总和
                        for (var i = 0; i < 17; i++) {
                            idCardWiSum += idCard.substring(i, i + 1) * idCardWi[i];
                        }
                        var idCardMod = idCardWiSum % 11;//计算出校验码所在数组的位置
                        var idCardLast = idCard.substring(17);//得到最后一位身份证号码
                        //如果等于2，则说明校验码是10，身份证号码最后一位应该是X
                        if (idCardMod == 2) {
                            if (idCardLast == "X" || idCardLast == "x") {
                                //alert("恭喜通过验证啦！");
                                return true;
                            } else {
                                //alert("身份证号码错误！");
                                Backend.api.toastr.error("身份证号码验证错误,请修改！");
                                return false;
                            }
                        } else {
                            //用计算出的验证码与最后一位身份证号码匹配，如果一致，说明通过，否则是无效的身份证号码
                            if (idCardLast == idCardY[idCardMod]) {
                                //alert("恭喜通过验证啦！");
                                return true;
                            } else {
                                //alert("身份证号码错误！");
                                Backend.api.toastr.error("身份证号码验证错误,请修改！");
                                return false;
                            }
                        }
                    }
                } else {
                    //alert("身份证格式不正确!");
                    Backend.api.toastr.error("身份证格式不正确!");
                    return false;
                }
            },
            showMonthFirstDay: function () {
                var Nowdate = new Date();
                var MonthFirstDay = new Date(Nowdate.getFullYear(), Nowdate.getMonth(), 1);
                M = Number(MonthFirstDay.getMonth()) + 1
                return MonthFirstDay.getFullYear() + "-" + M + "-" + MonthFirstDay.getDate() + ' 00:00:00';
            },
            showMonthLastDay: function () {
                var Nowdate = new Date();
                var MonthNextFirstDay = new Date(Nowdate.getFullYear(), Nowdate.getMonth() + 1, 1);
                var MonthLastDay = new Date(MonthNextFirstDay - 86400000);
                M = Number(MonthLastDay.getMonth()) + 1
                return MonthLastDay.getFullYear() + "-" + M + "-" + MonthLastDay.getDate() + ' 23:59:59';
            },
            defaultdate2: function () {
                //2019-07-01 00:00:00 - 2019-07-31 23:59:59
                var MonthFirstDay = Controller.api.showMonthFirstDay();
                var MonthLastDay = Controller.api.showMonthLastDay();

                return MonthFirstDay + " - " + MonthLastDay;
            },
            formatter: {//渲染的方法
                tkstatus: function (value, row, index) {
                    if (row.refundornot == '已退款') {
                        return [
                            '<a href="javascript:;" class="tkstatus text-success" data-id= "' + row.id + '" > ' + row.refundornot + '</a>'
                        ].join("")

                    }  else if (row.refundornot == '待退款') {
                        return [
                            '<a href="javascript:;" class="tkstatus text-warning" data-id= "' + row.id + '" > ' + row.refundornot + '</a>'
                        ].join("")

                    }  else if (row.refundornot == '需退款') {
                        return [
                            '<a href="javascript:;" class="tkstatus text-danger" data-id= "' + row.id + '" > ' + row.refundornot + '</a>'
                        ].join("")

                    }  else {
                        return [
                            '<a href="javascript:;" class="tkstatus" data-id= "' + row.id + '" > -- </a>'
                        ].join("")
                    }
                },
                tkstatus2: function (value, row, index) {
                    //新入状态 未办理 可以修改为需退款
                    //if (row.newjoin_status == '未办理') {
                        if (row.refundornot == '已退款') {
                            return [
                                '<a href="javascript:;" class="tkstatus text-success" data-id= "' + row.id + '" > ' + row.refundornot + '</a>'
                            ].join("")

                        }  else if (row.refundornot == '待退款') {
                            return [
                                '<a href="javascript:;" class="tkstatus text-warning" data-id= "' + row.id + '" > ' + row.refundornot + '</a>'
                            ].join("")

                        }  else if (row.refundornot == '需退款') {
                            return [
                                '<a href="javascript:;" class="tkstatus text-danger" data-id= "' + row.id + '" > ' + row.refundornot + '</a>'
                            ].join("")

                        }  else {
                            return [
                                '<a href="javascript:;" class="tkstatus" data-id= "' + row.id + '" > -- </a>'
                            ].join("")
                        }
                    //} else {
                    //    if (row.refundornot == '已退款') {
                    //        return [
                    //            '<a href="javascript:;" class="text-success" data-id= "' + row.id + '" > ' + row.refundornot + '</a>'
                    //        ].join("")
                    //
                    //    } else if (row.refundornot == '待退款') {
                    //        return [
                    //            '<a href="javascript:;" class=" text-warning" data-id= "' + row.id + '" > ' + row.refundornot + '</a>'
                    //        ].join("")
                    //
                    //    } else if (row.refundornot == '需退款') {
                    //        return [
                    //            '<a href="javascript:;" class=" text-danger" data-id= "' + row.id + '" > ' + row.refundornot + '</a>'
                    //        ].join("")
                    //
                    //    } else {
                    //        return [
                    //            '<a href="javascript:;"  data-id= "' + row.id + '" > -- </a>'
                    //        ].join("")
                    //    }
                    //}

                },
                xrstatus: function (value, row, index) {
                    if (row.newjoin_status != '已办理') {
                        return [
                            '<a href="javascript:;" class="xrstatus text-danger" data-id= "' + row.id + '" > ' + row.newjoin_status + '</a>'
                        ].join("")

                    }  else {
                        return [
                            '<a href="javascript:;" class="xrstatus" data-id= "' + row.id + '" > ' + row.newjoin_status + '</a>'
                        ].join("")
                    }
                },
                zcstatus: function (value, row, index) {
                    if (row.zc_status != '已办理') {
                        return [
                            '<a href="javascript:;" class="zcstatus text-danger" data-id= "' + row.id + '" > ' + row.zc_status + '</a>'
                        ].join("")

                    }  else {
                        return [
                            '<a href="javascript:;" class="zcstatus" data-id= "' + row.id + '" > ' + row.zc_status + '</a>'
                        ].join("")
                    }
                },
                tqzcstatus: function (value, row, index) {
                    if (row.earlytransfer == '是') {
                        return [
                            '<a href="javascript:;" class="tqzcstatus text-danger" data-id= "' + row.id + '" > ' + row.earlytransfer + '</a>'
                        ].join("")

                    }  else {
                        return [
                            '<a href="javascript:;" class="tqzcstatus" data-id= "' + row.id + '" > -- </a>'
                        ].join("")
                    }
                },
                paymentdate: function (value, row, index) {
                    // 2019-11 ~ 2019-12
                    //2019-10-08 11:10:18
                    var paymentdate0 = row.orderdate.substring(0,7);// 下单的月

                    if (value.indexOf("~") != -1) {
                        return [
                            '<span class="text-danger">' + value + '</span>'
                        ].join("")
                    } else if (value != paymentdate0) {
                        return [
                            '<span class="text-danger">' + value + '</span>'
                        ].join("")
                    } else {
                        return [
                            '<span>' + value + '</span>'
                        ].join("")
                    }
                },
                paymentbase: function (value, row, index) {
                    var minimumcardinality0 = Config.minimumcardinalitys[0];//个税
                    var minimumcardinality1 = Config.minimumcardinalitys[1];//公积金
                    var minimumcardinality2 = Config.minimumcardinalitys[2];//社保
                    var minimumcardinality3 = Config.minimumcardinalitys[3];//补充公积金

                    if (row.businesstype == '个税' && row.paymentbase > minimumcardinality0) {
                        return [
                            '<span class="text-danger">'+ row.paymentbase + '</span>'
                        ].join("")
                    } else if (row.businesstype == '公积金' && row.paymentbase > minimumcardinality1) {
                        return [
                            '<span class="text-danger">'+ row.paymentbase + '</span>'
                        ].join("")
                    } else if (row.businesstype == '社保' && row.paymentbase > minimumcardinality2) {
                        return [
                            '<span class="text-danger">'+ row.paymentbase + '</span>'
                        ].join("")
                    } else if (row.businesstype == '补充公积金' && row.paymentbase > minimumcardinality3) {
                        return [
                            '<span class="text-danger">'+ row.paymentbase + '</span>'
                        ].join("")
                    } else {
                        return [
                            '<span>'+ row.paymentbase + '</span>'
                        ].join("")
                    }
                },
                idnumber: function (value, row, index) {
                    //JSON.stringify(row)
                    //<button class="btn btn-success">复制</button>
                    //return [
                    //    '<a href="/admin/dahui/dingdan/index1?idnumber=' + row.idnumber + '&ref=addtabs" target="_parent" >\t' + row.idnumber + '</a>'
                    //].join("")
                    return [
                        '<a href="javascript:;" class="idnumber" data-id="/admin/dahui/dingdan/index1?idnumber=' + row.idnumber + '&ref=addtabs" target="_parent" >' + row.idnumber + '</a>'
                    ].join("")
                },
                taobaoname: function (value, row, index) {
                    return [
                        '<a href="javascript:;" class="taobaoname" data-tbname= "' + value + '" > ' + value + '</a>'
                    ].join("")
                }
            }
        }
    };
    return Controller;
});